﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using Utils.DatabaseUtils;
using Utils;

namespace Entity
{
    public class FeedBackUI
    {
        int _Feed_ID;

        public int Feed_ID
        {
            get { return _Feed_ID; }
            set { _Feed_ID = value; }
        }

        string _Feed_Title;

        public string Feed_Title
        {
            get { return _Feed_Title; }
            set { _Feed_Title = value; }
        }

        string _Feed_Message;

        public string Feed_Message
        {
            get { return _Feed_Message; }
            set { _Feed_Message = value; }
        }

        DateTime Feed_Date;

        public DateTime Feed_Date1
        {
            get { return Feed_Date; }
            set { Feed_Date = value; }
        }

        bool _Feed_Status;

        public bool Feed_Status
        {
            get { return _Feed_Status; }
            set { _Feed_Status = value; }
        }

        int _cusid;

        public int Cusid
        {
            get { return _cusid; }
            set { _cusid = value; }
        }


        public int Add(string Feed_Title, string Feed_Message, DateTime Feed_Date, bool Feed_Status, int cusid)
        {
            try
            {
                int result = SqlHelper.ExecuteNonQuery(Common.Conn, "FeedBack_add", Feed_Title, Feed_Message, Feed_Date, Feed_Status, cusid);
                return result;
            }
            catch (Exception ex)
            {
                return -1;
            }
        }

        public int Delete(int Feed_ID)
        {
            try
            {
                int result = SqlHelper.ExecuteNonQuery(Common.Conn, "FeedBack_delete", Feed_ID);
                return result;
            }
            catch (Exception ex)
            {
                return -1;
            }
        }

        public DataSet Statistic()
        {
            try
            {
                DataSet result = SqlHelper.ExecuteDataset(Common.Conn, "FeedBack_statistic");
                return result;
            }
            catch (Exception ex)
            {
                return null;
            }
        }

        public DataSet Get(int Feed_ID)
        {
            try
            {
                DataSet result = SqlHelper.ExecuteDataset(Common.Conn, "FeedBack_get", Feed_ID);
                return result;
            }
            catch (Exception e) { return null; }
        }

        public DataSet GetAll()
        {
            try
            {
                DataSet result = SqlHelper.ExecuteDataset(Common.Conn, "FeedBack_getall");
                return result;
            }
            catch (Exception e) { return null; }
        }

        public int Update(int Feed_ID, string Feed_Title, string Feed_Message, DateTime Feed_Date, bool Feed_Status, int cusid)
        {
            try
            {
                int result = SqlHelper.ExecuteNonQuery(Common.Conn, "FeedBack_update", Feed_ID, Feed_Title, Feed_Message, Feed_Date, Feed_Status, cusid);
                return result;
            }
            catch (Exception ex)
            {
                return -1;
            }
        }

        public int ChangeStatus(int Feed_ID,bool Feed_Status)
        {
            try
            {
                int result = SqlHelper.ExecuteNonQuery(Common.Conn, "FeedBack_ChangeStatus", Feed_ID, Feed_Status);
                return result;
            }
            catch (Exception ex)
            {
                return -1;
            }
        }

    }


}
